import os
import pwd

import grp

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
LOG_DIR = os.path.join(BASE_DIR, 'log')

config_rabbit = {  # rabbit mq 配置
    'rabbit_host': '192.168.74.1',  # ip
    'rabbit_port': '5672',  # 端口
    'rabbit_user': 'admin',
    'rabbit_pwd': 'admin',
    'virtual_host': '',  # 虚拟主机名称
    'store_queue': 'oj',  # 数据队列
    'business_queue': 'yt_business',  # 业务逻辑处理队列
    'message_queue': 'yt_msg',  # 短信发送队列
    'recharge_queue': 'recharge'  # 微信充值回调队列
}

JUDGE_FILE = '/home/charlie/Projects/my/judger_file'
JUDGER_WORKSPACE_BASE = "/judger/run"
LOG_BASE = "/log"

COMPILER_LOG_PATH = os.path.join(JUDGE_FILE, "compile.log")
JUDGER_RUN_LOG_PATH = os.path.join(LOG_BASE, "judger.log")
SERVER_LOG_PATH = os.path.join(LOG_BASE, "judge_server.log")

RUN_USER_UID = 0
RUN_GROUP_GID = 0

COMPILER_USER_UID = 0
COMPILER_GROUP_GID = 0

# RUN_USER_UID = pwd.getpwnam("code").pw_uid
# RUN_GROUP_GID = grp.getgrnam("code").gr_gid

# COMPILER_USER_UID = pwd.getpwnam("compiler").pw_uid
# COMPILER_GROUP_GID = grp.getgrnam("compiler").gr_gid

# SPJ_USER_UID = pwd.getpwnam("spj").pw_uid
# SPJ_GROUP_GID = grp.getgrnam("spj").gr_gid

TEST_CASE_DIR = "/test_case"
SPJ_SRC_DIR = "/judger/spj"
SPJ_EXE_DIR = "/judger/spj"

DB = None